package com.xinqi.modules.databank.v2.manager.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.service.impl.BaseServiceImpl;
import com.xinqi.modules.databank.dto.req.*;
import com.xinqi.modules.databank.dto.rsp.*;
import com.xinqi.modules.databank.v2.domain.CourseResourceEntity;
import com.xinqi.modules.databank.v2.manager.CourseResourceBaseManager;
import com.xinqi.modules.databank.v2.mapper.CourseResourceBaseMapper;
import com.xinqi.modules.stats.assistant.dto.rsp.AssistantTotalResultDTO;
import com.xinqi.modules.stats.assistant.dto.rsp.StudentInfoResultDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资料库基本信息Manager层
 * @author dzy
 */
@Service
@RequiredArgsConstructor
public class CourseResourceBaseManagerImpl extends BaseServiceImpl<CourseResourceBaseMapper, CourseResourceEntity> implements CourseResourceBaseManager {

    private final CourseResourceBaseMapper courseResourceBaseMapper;

    /**
     * 老师端查询已发布资料库
     * @author dzy
     */
    @Override
    public IPage<CourseResourceBaseResultDTO> teacherReleasePageList(IPage<CourseResourceBaseResultDTO> page, ResourceBaseQueryDTO queryDTO) {
        return courseResourceBaseMapper.teacherReleasePageList(page, queryDTO);
    }

    /**
     * 老师端查询已发布资料库
     * @author dzy
     */
    @Override
    public IPage<CourseResourceBaseResultDTO> teacherPageList(IPage<CourseResourceBaseResultDTO> page, ResourceBaseQueryDTO queryDTO) {
        return courseResourceBaseMapper.teacherPageList(page, queryDTO);
    }

    /**
     * 学生端查询已发布资料库
     * @author dzy
     */
    @Override
    public IPage<CourseResourceBaseResultDTO> pageList(IPage<CourseResourceBaseResultDTO> page, ResourceBaseQueryDTO queryDTO) {
        return courseResourceBaseMapper.pageList(page, queryDTO);
    }

    /**
     * 获取资料库基本信息
     * @author dzy
     */
    @Override
    public ResourceResponseDTO getResourceInfo(Long contentId) {
        return courseResourceBaseMapper.getResourceInfo(contentId);
    }

    /**
     * 资料库学习统计信息
     * @author dzy
     */
    @Override
    public List<ResourceStatisticsDTO> resourceStatistics(ResourceQueryDTO queryDTO) {
        return courseResourceBaseMapper.resourceStatistics(queryDTO);
    }

    /**
     * 学生端记录学生下载次数
     * @author dzy
     */
    @Override
    public List<CourseResourceEntity> selectBatchIds(List<Long> ids) {
        return courseResourceBaseMapper.selectBatchIds(ids);
    }

    /**
     * 更新资料库发布状态
     * @author dzy
     */
    @Override
    public Boolean updatePublishById(Long id) {
        return courseResourceBaseMapper.updatePublishById(id);
    }


}
